package com.atguigu02.project;

/**
 * ClassName: CustomerView
 * Package: com.atguigu02.project
 * Description:
 * CustomerView为主模块，负责菜单的显示和处理用户操作
 *
 * @Author 姜
 * @Create 2023/11/21 11:59
 * @Version 1.0
 */
public class CustomerView {
    CustomerList customerList = new CustomerList(10);

    /*
     * 进入主界面的方法
     * */
    public void enterMainMenu() {
        boolean isFlag = true;
        while (true) {
            // 显示界面
            System.out.println("\n--------------------拼爹爹电商客户管理系统-----------------------\n");
            System.out.println("                      1. 添 加 客 户");
            System.out.println("                      2. 修 改 客 户");
            System.out.println("                      3. 删 除 客 户");
            System.out.println("                      4. 客 户 列 表");
            System.out.println("                      5. 退      出\n");
            System.out.println("                      请选择(1-5): ");
            char key = CMUtility.readMenuSelection();
            switch (key) {
                case '1':
                    addNewCustomer();
                    break;
                case '2':
                    modifyCustomer();
                    break;
                case '3':
                    deleteCustomer();
                    break;
                case '4':
                    listAllCustomers();
                    break;
                case '5':
                    System.out.println("是否确定退出(Y/N): ");
                    char isExit = CMUtility.readConfirmSelection();
                    if(isExit == 'Y') {
                        // 获取用户选择：5
                        isFlag = false;
                    }
                    break;
            }
        }
    }

    private void addNewCustomer() {

    }

    private void modifyCustomer() {

    }

    private void deleteCustomer() {

    }

    private void listAllCustomers() {

    }

    public static void main(String[] args) {
        CustomerView view = new CustomerView();
        view.enterMainMenu();
    }
}
